<?php
require(dirname(__FILE__)."/../inc/common.inc.php");
admin(0);
?>
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<meta name="renderer" content="webkit|ie-comp|ie-stand">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
<meta http-equiv="Cache-Control" content="no-siteapp" />
<!--[if lt IE 9]>
<script type="text/javascript" src="js/html5.js"></script>
<script type="text/javascript" src="js/respond.min.js"></script>
<script type="text/javascript" src="js/PIE_IE678.js"></script>
<![endif]-->
<link type="text/css" rel="stylesheet" href="css/H-ui.css"/>
<link type="text/css" rel="stylesheet" href="css/H-ui.admin.css"/>
<link type="text/css" rel="stylesheet" href="font/font-awesome.min.css"/>
<!--[if IE 7]>
<link href="font/font-awesome-ie7.min.css" rel="stylesheet" type="text/css" />
<![endif]-->
<title>系统日志</title>
</head>
<body>
<?php
if($act=='list'){
	$rss = $db->get_one("select * from `{$pre}log` where id='$id'");
	if(!$rss){
		die('err');
	}
?>
<style type="text/css">
<!--
body,td,th {
	font-size: 12px;
}
body{margin:0px;}
-->
</style>
    <table class="table table-bg">
 
  <tr>
    <td width="11%" height="22" align="right" bgcolor="#FFFFFF">操作人：</td>
    <td width="89%" height="22" bgcolor="#FFFFFF"><?=$rss['admin']?></td>
  </tr>
  <tr>
    <td height="22" align="right" bgcolor="#FFFFFF">操作类型：</td>
    <td height="22" bgcolor="#FFFFFF"><?=$rss['title']?></td>
  </tr>
  <tr>
    <td height="22" align="right" bgcolor="#FFFFFF">操作时间：</td>
    <td height="22" bgcolor="#FFFFFF"><?=date("Y-m-d H:i:s",$rss['time'])?></td>
  </tr>
  <tr>
    <td height="22" align="right" bgcolor="#FFFFFF">操作Ip：</td>
    <td height="22" bgcolor="#FFFFFF"><?=$rss['ip']?></td>
  </tr>
  <tr>
    <td height="22" align="right" bgcolor="#FFFFFF">详细：</td>
    <td height="22" bgcolor="#FFFFFF" style="line-height:18px;"><pre><?=$rss['content']?></pre></td>
  </tr>
</table>




<?php
}else{
?>
<script language="javascript" type="text/javascript" src="My97DatePicker/WdatePicker.js"></script>
<nav class="Hui-breadcrumb"> <?=get_category(6)?> <a class="btn btn-success radius r mr-20" style="line-height:1.6em;margin-top:3px" href="javascript:location.replace(location.href);" title="刷新" ><i class="icon-refresh"></i></a></nav>
<div class="pd-20">
  <div  >
<table width="100%" border="0" cellpadding="0" cellspacing="0" >
<form method="get" name="sfrom">
				<tr>
					<td width="70" align="right">查询时间：</td>
        <!--{dateFmt:'yyyy-MM-dd HH:mm:ss'}-->
					<td><input type="text" name="stime"  class="Wdate input-text" onClick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'})"  style="width:130px; height:19px;  color:#666; line-height:19px;" value="<?=$stime?>"  /> <input value="<?=$etime?>" type="text" name="etime"  class="Wdate input-text" onClick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'})" style="width:130px; height:19px;  color:#666; line-height:19px;"  />
				   <select style="color:#666"  class="select"  name="area"><option value="">操作类型</option>
                    <?php
$query =$db->query("select title from `{$pre}log` group by title");
while($rss =$db->fetch_array($query)){	
?>
                    <option value="<?=$rss['title']?>" <?=$area==$rss['title']?'selected':''?> >--<?=$rss['title']?>--</option>
<?php
}
?>
                    </select>
				  <input type="text" name="key" class="input-text" value="<?=$key?$key:'请输入日志关键字'?>" onClick="if(this.value=='<?=$key?$key:'请输入日志关键字'?>'){this.value='';}" style="background:#FFFFFF; width:180px; color:#666666; " />
				  <input type="submit" name="s" value="搜索" class="btn btn-success radius" />                  </td>
    </tr>
  </form>
</table>
			
<?php
if($key=='请输入日志关键字'){
	$key='';
}
?>
 <table class="table table-border table-bordered table-bg">
<tr class="thead">
  <th height="22" colspan="6" bgcolor="#f7f7f7" class="topbg" >&nbsp;&nbsp;操作日志查看</th>
</tr>
<form name="form3" method="post" enctype="multipart/form-data">

	<tr  bgcolor="#f7f7f7">
   	  <td width="2%" height="24" align="center" bgcolor="#FFFFFF" >ID</td>
      <td width="22%" align="center" bgcolor="#FFFFFF">操作用户</td>
      <td width="19%" align="center" bgcolor="#FFFFFF">操作类型</td>
      <td width="20%" align="center" bgcolor="#FFFFFF">ip</td>
      <td width="21%" align="center" bgcolor="#FFFFFF">时间</td>
      <td width="16%" align="center" bgcolor="#FFFFFF">操作</td>
  </tr>
<?php

$rows=20;
$page=$_GET['page'];
if($page<1){
	$page=1;
}

$min=($page-1)*$rows;





if(!empty($area)){
	$isql2.=" and  a.title='$area'";
}

if(!empty($key)){
	$isql2.=" and  (a.content like '%$key%' or a.title like '%$key%' or a.admin like '%$key%' or a.ip like '%$key%')";
}
if(!empty($stime)){
	$stime=strtotime($stime);
	$isql2.=" and  a.time >='$stime' ";
}
if(!empty($etime)){
	$etime=strtotime($etime);
	$isql2.=" and  a.time <='$etime'";
}




$i=0;

$query =$db->query("select a.* from `{$pre}log` a   left join {$pre}admin b on (a.adminid=b.u_id)  where a.id>'0' $isql2 order by a.id desc LIMIT $min,$rows");
while($rs =$db->fetch_array($query)){	
$i++;
?>
  
  <tr  bgcolor="#f7f7f7">
   	  <td height="22" align="center" bgcolor="#FFFFFF" ><?=$rs['id']?></td>
      <td align="center" bgcolor="#FFFFFF"><?=$rs['admin']?></td>
      <td align="center" bgcolor="#FFFFFF"><?=$rs['title']?></td>
      <td align="center" bgcolor="#FFFFFF"><?=$rs['ip']?></td>
      <td align="center" bgcolor="#FFFFFF"><?=date("Y-m-d H:i:s",$rs['time'])?></td>
      <td align="center" bgcolor="#FFFFFF"><a href="javascript:;"  onClick="article_class_edit('<?=$rs['id']?>','800','420','日志详细','?act=list&id=<?=$rs['id']?>')">详细</a></td>
  </tr>

<?php
}
?> 

  <tr  bgcolor="#f7f7f7">
    <td height="22" colspan="6" align="center" bgcolor="#FFFFFF" ><?=getpage("`{$pre}log` a   left join {$pre}admin b on (a.adminid=b.u_id)","where a.id>'0' $isql2","?area=$area&stime=$stime&etime=$etime&key=$key",$rows)?></td>
    </tr>
  </form>
</table>
</div>
</div>
<?php
}
?>
<script type="text/javascript" src="js/jquery.min.js"></script>
<script type="text/javascript" src="js/Validform_v5.3.2_min.js"></script> 
<script type="text/javascript" src="layer/layer.min.js"></script>
<script type="text/javascript" src="js/H-ui.js"></script>
<script type="text/javascript" src="js/H-ui.admin.js"></script>
<script type="text/javascript">
$(".Huiform").Validform(); 
</script>

</body>
</html>